package com.ruge.spring.cloud.gateway.error;

import com.ruge.spring.cloud.gateway.base.exception.IError;

/**
 * @author 嘿丷如歌
 * @version V1.0
 * @Description: 网关异常
 * @date 2021/4/26 20:03
 */

public enum ApiGatewayError implements IError {

    UNKNOWN_TOKEN_ERROR("4400", "unknown token authentication error"),
    TOKEN_NOT_FOND("4401", "token not found"),
    TOKEN_AUTH_FAILED("4402", "authenticate token failed"),
    REQUEST_PATH_INVALID("4403", "request path is invalid"),
    REQUEST_PARAMETER_INVALID("4404", "request parameter is invalid"),
    APPKEY_PARAMETER_NOT_FOUND("4405", "request parameter appkey not found"),
    SIGNATURE_VALIDATION_FAILED("4406", "The signature validate failed"),
    SIGNATURE_INVALID("4407", "The signature is invalid"),
    UNKNOWN_APPKEY_ERROR("4408", "unknown appkey check error"),
    API_GATEWAY_ERROR("4409", "api gateway Error"),
    ADMIN_TOKEN_ERROR("4410", "admin token format error"),
    ;


    String errorCode;

    String errorMessage;

    ApiGatewayError(String errorCode, String errorMessage) {
        this.errorCode = errorCode;
        this.errorMessage = errorMessage;
    }

    private static final String NAMESPACE = "API-GATEWAY";

    @Override
    public String getNamespace() {
        return null;
    }

    @Override
    public String getErrorCode() {
        return NAMESPACE + "." + errorCode;
    }

    @Override
    public String getErrorMessage() {
        return errorMessage;
    }
}
